.class public Lcom/facebook/orca/protocol/GetMeUserMethod;
.super Ljava/lang/Object;
.source "GetMeUserMethod.java"

# interfaces
.implements Lcom/facebook/orca/protocol/ApiMethod;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/facebook/orca/protocol/ApiMethod",
        "<",
        "Ljava/lang/Void;",
        "Lcom/facebook/orca/server/GetMeUserResult;",
        ">;"
    }
.end annotation


# instance fields
.field private final a:Lcom/facebook/orca/protocol/UserFqlHelper;

.field private final b:Lcom/facebook/orca/users/UserSerialization;


# direct methods
.method public constructor <init>(Lcom/facebook/orca/protocol/UserFqlHelper;Lcom/facebook/orca/users/UserSerialization;)V
    .locals 0
    .parameter
    .parameter
    .annotation runtime Lcom/google/inject/Inject;
    .end annotation

    .prologue
    .line 31
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 32
    iput-object p1, p0, Lcom/facebook/orca/protocol/GetMeUserMethod;->a:Lcom/facebook/orca/protocol/UserFqlHelper;

    .line 33
    iput-object p2, p0, Lcom/facebook/orca/protocol/GetMeUserMethod;->b:Lcom/facebook/orca/users/UserSerialization;

    .line 34
    return-void
.end method

.method private a()Ljava/lang/String;
    .locals 3

    .prologue
    .line 45
    new-instance v0, Lcom/facebook/orca/protocol/FqlMultiQueryHelper;

    invoke-direct {v0}, Lcom/facebook/orca/protocol/FqlMultiQueryHelper;-><init>()V

    .line 46
    const-string v1, "user"

    const-string v2, "SELECT uid, first_name, last_name, contact_email, phones, is_pushable, affiliations FROM user WHERE uid=me()"

    invoke-virtual {v0, v1, v2}, Lcom/facebook/orca/protocol/FqlMultiQueryHelper;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 50
    const-string v1, "profile"

    const-string v2, "SELECT id, name, type, pic_big, pic_square, pic_crop FROM profile WHERE id=me()"

    invoke-virtual {v0, v1, v2}, Lcom/facebook/orca/protocol/FqlMultiQueryHelper;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 53
    invoke-virtual {v0}, Lcom/facebook/orca/protocol/FqlMultiQueryHelper;->a()Lorg/json/JSONObject;

    move-result-object v0

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


# virtual methods
.method public bridge synthetic a(Ljava/lang/Object;)Lcom/facebook/orca/protocol/ApiRequest;
    .locals 1
    .parameter

    .prologue
    .line 23
    check-cast p1, Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/facebook/orca/protocol/GetMeUserMethod;->a(Ljava/lang/Void;)Lcom/facebook/orca/protocol/ApiRequest;

    move-result-object v0

    return-object v0
.end method

.method public a(Ljava/lang/Void;)Lcom/facebook/orca/protocol/ApiRequest;
    .locals 5
    .parameter

    .prologue
    .line 38
    invoke-static {}, Lcom/google/common/collect/Lists;->a()Ljava/util/ArrayList;

    move-result-object v0

    .line 39
    new-instance v1, Lorg/apache/http/message/BasicNameValuePair;

    const-string v2, "format"

    const-string v3, "json"

    invoke-direct {v1, v2, v3}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 40
    new-instance v1, Lorg/apache/http/message/BasicNameValuePair;

    const-string v2, "queries"

    invoke-direct {p0}, Lcom/facebook/orca/protocol/GetMeUserMethod;->a()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 41
    new-instance v1, Lcom/facebook/orca/protocol/ApiRequest;

    const-string v2, "meUser"

    const-string v3, "GET"

    const-string v4, "method/fql.multiquery"

    invoke-direct {v1, v2, v3, v4, v0}, Lcom/facebook/orca/protocol/ApiRequest;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V

    return-object v1
.end method

.method public a(Ljava/lang/Void;Lcom/facebook/orca/protocol/ApiResponse;)Lcom/facebook/orca/server/GetMeUserResult;
    .locals 4
    .parameter
    .parameter

    .prologue
    .line 58
    invoke-virtual {p2}, Lcom/facebook/orca/protocol/ApiResponse;->a()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/facebook/orca/protocol/ApiResponseWrapper;->a(Ljava/lang/String;)Lcom/facebook/orca/protocol/ApiResponseWrapper;

    move-result-object v0

    .line 59
    invoke-virtual {v0}, Lcom/facebook/orca/protocol/ApiResponseWrapper;->b()Lorg/json/JSONArray;

    move-result-object v0

    .line 60
    new-instance v1, Lcom/facebook/orca/protocol/FqlResultHelper;

    invoke-direct {v1, v0}, Lcom/facebook/orca/protocol/FqlResultHelper;-><init>(Lorg/json/JSONArray;)V

    .line 61
    const-string v0, "user"

    invoke-virtual {v1, v0}, Lcom/facebook/orca/protocol/FqlResultHelper;->a(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v0

    .line 62
    const-string v2, "profile"

    invoke-virtual {v1, v2}, Lcom/facebook/orca/protocol/FqlResultHelper;->a(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v1

    .line 63
    iget-object v2, p0, Lcom/facebook/orca/protocol/GetMeUserMethod;->a:Lcom/facebook/orca/protocol/UserFqlHelper;

    invoke-virtual {v2, v0, v1}, Lcom/facebook/orca/protocol/UserFqlHelper;->a(Lorg/json/JSONArray;Lorg/json/JSONArray;)Lorg/json/JSONArray;

    move-result-object v0

    .line 64
    iget-object v1, p0, Lcom/facebook/orca/protocol/GetMeUserMethod;->b:Lcom/facebook/orca/users/UserSerialization;

    sget-object v2, Lcom/facebook/orca/users/User$Type;->FACEBOOK:Lcom/facebook/orca/users/User$Type;

    invoke-virtual {v1, v2, v0}, Lcom/facebook/orca/users/UserSerialization;->a(Lcom/facebook/orca/users/User$Type;Lorg/json/JSONArray;)Lcom/google/common/collect/ImmutableList;

    move-result-object v0

    .line 65
    invoke-virtual {v0}, Lcom/google/common/collect/ImmutableList;->size()I

    move-result v1

    const/4 v2, 0x1

    if-eq v1, v2, :cond_0

    .line 66
    new-instance v0, Ljava/lang/Exception;

    const-string v1, "Invalid api response - multiple result users"

    invoke-direct {v0, v1}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    throw v0

    .line 68
    :cond_0
    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/google/common/collect/ImmutableList;->get(I)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/facebook/orca/users/User;

    .line 69
    new-instance v0, Lcom/facebook/orca/server/GetMeUserResult;

    sget-object v1, Lcom/facebook/orca/server/DataFreshnessResult;->FROM_SERVER:Lcom/facebook/orca/server/DataFreshnessResult;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    invoke-direct {v0, v1, p0, v2, v3}, Lcom/facebook/orca/server/GetMeUserResult;-><init>(Lcom/facebook/orca/server/DataFreshnessResult;Lcom/facebook/orca/users/User;J)V

    return-object v0
.end method

.method public bridge synthetic a(Ljava/lang/Object;Lcom/facebook/orca/protocol/ApiResponse;)Ljava/lang/Object;
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 23
    check-cast p1, Ljava/lang/Void;

    invoke-virtual {p0, p1, p2}, Lcom/facebook/orca/protocol/GetMeUserMethod;->a(Ljava/lang/Void;Lcom/facebook/orca/protocol/ApiResponse;)Lcom/facebook/orca/server/GetMeUserResult;

    move-result-object v0

    return-object v0
.end method
